﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SmartMotion.Core;

namespace IOC0640Lib
{
    public class IOCtrl0640:IoCtrlBase
    {
        public IOCtrl0640()
        {
        }

        public override bool InitIoCtrl()
        {
           return IOC0640.ioc_board_init()>0;
        }

        public override bool CloseIoCtrl()
        {
            IOC0640.ioc_board_close();
            return true;
        }

        public override int ReadInBit(ushort bitNo)
        {
            return IOC0640.ioc_read_inbit(CardID, bitNo);
        }

        public override int ReadOutBit(ushort bitNo)
        {
            return IOC0640.ioc_read_outbit(CardID, bitNo);
        }

        public override int ReadInPort(ushort portNo)
        {
            return IOC0640.ioc_read_inport(CardID, portNo);
        }

        public override int ReadOutPort(ushort portNo)
        {
            return IOC0640.ioc_read_outport(CardID, portNo);
        }

        public override int WriteOutbit(ushort bitNo, ushort onOff)
        {
            return (int)IOC0640.ioc_write_outbit(CardID, bitNo,onOff);
        }

        public override int WriteOutPort(ushort portNo, ushort portValue)
        {
            return (int)IOC0640.ioc_write_outport(CardID, portNo, portValue);
        }
    }
}
